﻿using System.Xml;
using System.Xml.Serialization;
using System;
using System.ComponentModel;


namespace KSS.Generator.Configuration
{
    public enum PropertyType
    {
        Local,
        Global,
        Custom
    }

    public enum PropertyDataType
    {
        String,
        Number,
        Boolean,
        Color,
        Font,
        Size,
        Image
    }

    public class PropertySetting : ICloneable
    {
        public PropertySetting()
        {
            Name = string.Empty;
            Description = string.Empty;
            Type = PropertyType.Local;
            Assembly = string.Empty;
            DataType = PropertyDataType.String.ToString();
            Text = string.Empty;
            Value = string.Empty;            
        }

        public PropertySetting(string name)
            : this()
        {
            Name = name;
        }

        public PropertySetting(string name, PropertyType type)
            : this(name)
        {
            Type = type;
        }


        [XmlAttribute]
        public string Name;

        [XmlAttribute]
        public string Description;

        [XmlAttribute]
        public PropertyType Type;

        [XmlAttribute]
        public string DataType;

        [XmlAttribute]
        public string Assembly;

        [XmlAttribute]
        public string Text;

        [XmlAttribute]
        public string Value;

        public override string ToString()
        {
            return Name;
        }

        #region ICloneable Members

        public object Clone()
        {
            PropertySetting setting = new PropertySetting();
            setting.Name = Name;
            setting.Description = Description;
            setting.Type = Type;
            setting.Assembly = Assembly;
            setting.DataType = DataType;
            setting.Text = Text;
            setting.Value = Value;

            return setting;
        }

        #endregion
    }
}
